package com.probox.modules.job;

import com.probox.common.entity.domain.customer.CustomerFundDetail;
import com.probox.common.entity.domain.customer.CustomerInfo;
import com.probox.common.entity.service.customer.ICustomerFundDetailService;
import com.probox.common.entity.service.customer.ICustomerFundService;
import com.probox.common.entity.service.customer.ICustomerInfoService;
import com.probox.common.entity.vo.customer.CustomerRmfVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 会员的rmf计算
 */
@Component("customerRmfJob")
public class CustomerRmfJob {

    private static final Logger logger = LoggerFactory.getLogger(CustomerRmfJob.class);

    @Autowired
    private ICustomerFundService customerFundService;

    @Autowired
    private ICustomerFundDetailService customerFundDetailService;

    public void computeRmf(){
        logger.info("============================开始执行抵扣确认任务=====================");
        List<CustomerFundDetail> list = customerFundDetailService.queryWaitDeductList();
        for (CustomerFundDetail ci:list) {
            try {
                customerFundService.confirmDeduction(ci);
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        logger.info("============================结束执行抵扣确认任务=====================");
    }

}
